package org.seven.jrdp.commons.config;

import java.lang.reflect.Field;
import java.util.Map;

import org.seven.jrdp.commons.util.StringUtils;

public abstract class ParamConfig {
	public static String project;
	public static String version;
	public static String copyright;
	public static String upload;
	public static String ukey;
	public static String privateKey;
	public static String ysls;
	public static String zlwc;
	public static String ckhs;
	public static String dyj;

	public static void init(Map<String, String> map) {
		Field[] fields = ParamConfig.class.getDeclaredFields();
		for (Field field : fields) {
			String value = StringUtils.getString(map.get(field.getName()));
			try {
				field.set(null, value);
			} catch (Exception e) {
				throw new RuntimeException();
			}
		}
	}

	public static int getZlwc() {
		try {
			return Integer.parseInt(zlwc);
		} catch (Exception e) {
			return 0;
		}
	}

	public static int getCkhs() {
		try {
			return Integer.parseInt(ckhs);
		} catch (Exception e) {
			return 0;
		}
	}
}